{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Cells in a Range on an Excel Sheet"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: cellsInRange"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #Excel 表中某个范围内的单元格"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>Excel 表中的一个单元格 <code>(r, c)</code> 会以字符串 <code>\"&lt;col&gt;&lt;row&gt;\"</code> 的形式进行表示，其中：</p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>&lt;col&gt;</code> 即单元格的列号 <code>c</code> 。用英文字母表中的 <strong>字母</strong> 标识。\n",
    "\n",
    "\t<ul>\n",
    "\t\t<li>例如，第 <code>1</code> 列用 <code>'A'</code> 表示，第 <code>2</code> 列用 <code>'B'</code> 表示，第 <code>3</code> 列用 <code>'C'</code> 表示，以此类推。</li>\n",
    "\t</ul>\n",
    "\t</li>\n",
    "\t<li><code>&lt;row&gt;</code> 即单元格的行号 <code>r</code> 。第 <code>r</code> 行就用 <strong>整数</strong> <code>r</code> 标识。</li>\n",
    "</ul>\n",
    "\n",
    "<p>给你一个格式为 <code>\"&lt;col1&gt;&lt;row1&gt;:&lt;col2&gt;&lt;row2&gt;\"</code> 的字符串 <code>s</code> ，其中 <code>&lt;col1&gt;</code> 表示 <code>c1</code> 列，<code>&lt;row1&gt;</code> 表示 <code>r1</code> 行，<code>&lt;col2&gt;</code> 表示 <code>c2</code> 列，<code>&lt;row2&gt;</code> 表示 <code>r2</code> 行，并满足 <code>r1 &lt;= r2</code> 且 <code>c1 &lt;= c2</code> 。</p>\n",
    "\n",
    "<p>找出所有满足&nbsp;<code>r1 &lt;= x &lt;= r2</code> 且 <code>c1 &lt;= y &lt;= c2</code> 的单元格，并以列表形式返回。单元格应该按前面描述的格式用 <strong>字符串</strong> 表示，并以 <strong>非递减</strong> 顺序排列（先按列排，再按行排）。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2022/02/08/ex1drawio.png\" style=\"width: 250px; height: 160px;\" /></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>s = \"K1:L2\"\n",
    "<strong>输出：</strong>[\"K1\",\"K2\",\"L1\",\"L2\"]\n",
    "<strong>解释：</strong>\n",
    "上图显示了列表中应该出现的单元格。\n",
    "红色箭头指示单元格的出现顺序。\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2022/02/09/exam2drawio.png\" style=\"width: 500px; height: 50px;\" /></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>s = \"A1:F1\"\n",
    "<strong>输出：</strong>[\"A1\",\"B1\",\"C1\",\"D1\",\"E1\",\"F1\"]\n",
    "<strong>解释：</strong>\n",
    "上图显示了列表中应该出现的单元格。 \n",
    "红色箭头指示单元格的出现顺序。\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>s.length == 5</code></li>\n",
    "\t<li><code>'A' &lt;= s[0] &lt;= s[3] &lt;= 'Z'</code></li>\n",
    "\t<li><code>'1' &lt;= s[1] &lt;= s[4] &lt;= '9'</code></li>\n",
    "\t<li><code>s</code> 由大写英文字母、数字、和 <code>':'</code> 组成</li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [cells-in-a-range-on-an-excel-sheet](https://leetcode.cn/problems/cells-in-a-range-on-an-excel-sheet/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [cells-in-a-range-on-an-excel-sheet](https://leetcode.cn/problems/cells-in-a-range-on-an-excel-sheet/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['\"K1:L2\"', '\"A1:F1\"']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        maxNum=int(s[-1])\n",
    "        maxLet=s[-2]\n",
    "        minLet=s[0]\n",
    "        minNum=int(s[1])\n",
    "        res=[]\n",
    "        for i in range(ord(s[-2])-ord(s[0])+1):\n",
    "            for j in range(minNum,maxNum+1):\n",
    "                res+=[chr(i+ord(s[0]))+str(j)]\n",
    "        return res\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for i in range(26):\n",
    "            w = chr(ord(\"A\")+i)\n",
    "            if s[0] <= w <= s[3]:\n",
    "                for d in range(1, 10):\n",
    "                    if s[1] <= str(d) <= s[4]:\n",
    "                        ans.append(w+str(d))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        lst=[]\n",
    "        for i in range(ord(s[0]),ord(s[3])+1):\n",
    "            for j in range(int(s[1]),int(s[4])+1):\n",
    "                lst.append(chr(i)+str(j))\n",
    "        return lst"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for i in range(ord(s[0]),ord(s[3])+1):\n",
    "            for j in range(int(s[1]),int(s[4])+1):\n",
    "                res.append(chr(i)+str(j))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        a, b = s.split(':')\n",
    "        ans = []\n",
    "        x = ord(b[0]) - ord(a[0])\n",
    "        y = int(b[1:]) - int(a[1:])\n",
    "        for i in range(x + 1):\n",
    "            for j in range(y + 1):\n",
    "                t = f\"{chr(ord(a[0]) + i)}{int(a[1:]) + j}\"\n",
    "                ans.append(t)\n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        col_1, col_2=ord(s[0]),ord(s[3])\n",
    "        row_1, row_2=int(s[1]),int(s[4])\n",
    "        res=[]\n",
    "        for c in range(col_1, col_2+1):\n",
    "            for r in range(row_1, row_2+1):\n",
    "                value=chr(c)+str(r)\n",
    "                res.append(value)\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        result = []\n",
    "        for i in range(ord(s[0]), ord(s[3])+1):\n",
    "            for j in range(ord(s[1]), ord(s[4])+1):\n",
    "                result.append(chr(i)+chr(j))\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ls = s.split(':')\n",
    "        start_row = int(ls[0][1:])\n",
    "        start_col = ord(ls[0][0])\n",
    "        end_row = int(ls[1][1:])\n",
    "        end_col = ord(ls[1][0])\n",
    "        res = []\n",
    "        for c in range(end_col - start_col + 1):\n",
    "            for r in range(end_row - start_row + 1):\n",
    "                res.append(chr(start_col + c) + str(start_row + r))\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for i in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for j in range(ord(s[1]), ord(s[4]) + 1):\n",
    "               ans.append(chr(i) + chr(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "from typing import List\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        \n",
    "        res = []\n",
    "        start_str, end_str = s.split(\":\")\n",
    "        # print(start_str)\n",
    "        # print(end_str)\n",
    "        \n",
    "        start_letter = ord(start_str[0]) - ord(\"A\")\n",
    "        end_letter = ord(end_str[0]) - ord(\"A\")\n",
    "        start_num = int(start_str[1])\n",
    "        end_num = int(end_str[1])\n",
    "        # print(chr(1+ord(\"a\")))     \n",
    "        \n",
    "        for i in range(start_letter, end_letter+1):\n",
    "            for j in range(start_num, end_num+1):\n",
    "                cur = \"\"\n",
    "                cur += chr(i + ord(\"A\"))\n",
    "                cur += str(j)\n",
    "                res.append(cur)\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        lst = s.split(\":\")\n",
    "        nums = [i[1] for i in lst]\n",
    "        letters = [i[0] for i in lst]\n",
    "        res = []\n",
    "\n",
    "        for i in range(ord(letters[0]),ord(letters[1])+1):\n",
    "            for j in range(int(nums[0]), int(nums[1])+1):\n",
    "                res.append([chr(i), str(j)])\n",
    "        ans = []\n",
    "        for i in res:\n",
    "            ans.append(''.join(i))\n",
    "\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        col1, col2 = s[0], s[3]\n",
    "        row1, row2 = int(s[1]), int(s[4])\n",
    "\n",
    "        res = []\n",
    "        lenRow = row2 - row1 + 1\n",
    "        lenCol = ord(col2) - ord(col1) + 1\n",
    "        for j in range(0, lenCol):\n",
    "            for i in range(0, lenRow):\n",
    "                res.append(str(chr(ord(col1) + j)) + str(row1 + i))\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        result = []\n",
    "        for i in range(ord(s[0]), ord(s[3])+1):\n",
    "            for j in range(ord(s[1]), ord(s[4])+1):\n",
    "                result.append(chr(i)+chr(j))\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for row in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for col in range(ord(s[1]), ord(s[4]) + 1):\n",
    "                res.append(chr(row) + chr(col))\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for i in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for j in range(int(s[1]),int(s[4]) + 1):\n",
    "                ans.append(chr(i) + str(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        sc = s.split(\":\")[0][0]\n",
    "        ec = s.split(\":\")[1][0]\n",
    "        sr = int(s.split(\":\")[0][1])\n",
    "        er = int(s.split(\":\")[1][1])\n",
    "        for i in range(ord(sc),ord(ec)+1):\n",
    "            for j in range(sr,er+1):\n",
    "                g = chr(i)+str(j)\n",
    "                res.append(g)\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans=[]\n",
    "        for i in range(ord(s[-2])-ord(s[0])+1):\n",
    "            for j in range(int(s[1]),int(s[-1])+1):\n",
    "                ans.append(chr(ord(s[0])+i)+str(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "                return [chr(r) + str(c) for r in range(ord(s[0]), ord(s[3]) + 1) for c in range(int(s[1]), int(s[4]) + 1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        s1 = s.split(':')[0]\n",
    "        s2 = s.split(':')[-1]\n",
    "        c1 = s1[0]\n",
    "        c2 = s2[0]\n",
    "        r1 = s1[1:]\n",
    "        r2 = s2[1:]\n",
    "        res1 = []\n",
    "        for i in range(ord(c1),ord(c2)+1):\n",
    "            res1.append(chr(i))\n",
    "        res2 = []\n",
    "        for j in range(int(r1),int(r2)+1):\n",
    "            res2.append(str(j))\n",
    "        ans = []\n",
    "        for m in res1:\n",
    "            for n in res2:\n",
    "                ans.append(m+n)\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        sl=s.split(':')        \n",
    "        for j in range(len(sl[0])):\n",
    "            if sl[0][j].isdigit():\n",
    "                a1,b1=sl[0][:j],sl[0][j:]\n",
    "        for j in range(len(sl[1])):\n",
    "            if sl[1][j].isdigit():\n",
    "                a2,b2=sl[1][:j],sl[1][j:]\n",
    "        res=[]\n",
    "        for i in range(ord(a1),ord(a2)+1):\n",
    "            for j in range(int(b1),int(b2)+1):\n",
    "                res.append(chr(i)+str(j))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for row in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for col in range(ord(s[1]),ord(s[4])+1):\n",
    "                res.append(chr(row)+chr(col))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        retVal = []\n",
    "\n",
    "        for row in range(ord(s[0]), ord(s[3])+1):\n",
    "            for col in range(ord(s[1]), ord(s[4])+1):\n",
    "                cell = chr(row) + chr(col)\n",
    "                retVal.append(cell)\n",
    "\n",
    "        return retVal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for c in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for r in range(int(s[1]), int(s[4]) + 1):\n",
    "                ans.append(chr(c) + str(r))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        result=[]\n",
    "        col1=ord(s[0])\n",
    "        row1=ord(s[1])\n",
    "        col2=ord(s[-2])\n",
    "        row2=ord(s[-1])\n",
    "        for i in range(col1,col2+1):\n",
    "            for j in range(row1,row2+1):\n",
    "                result.append(chr(i)+chr(j))\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        retVal = []\n",
    "\n",
    "        # s.length == 5\n",
    "        # 'A' <= s[0] <= s[3] <= 'Z'\n",
    "        # '1' <= s[1] <= s[4] <= '9'\n",
    "        for row in range(ord(s[0]), ord(s[3])+1):\n",
    "            for col in range(ord(s[1]), ord(s[4])+1):\n",
    "                cell = chr(row) + chr(col)\n",
    "                retVal.append(cell)\n",
    "\n",
    "        return retVal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        return [chr(i)+str(j) for i in range(ord(s[0]), ord(s[3])+1) for j in range(int(s[1]), int(s[4])+1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        #ord(\"A\")=65\n",
    "        #字符串转asc码 ord()\n",
    "        #asc码转字符串 chr()\n",
    "        w=s.split(\":\")\n",
    "        c1,r1,c2,r2=ord(w[0][0]),int(w[0][1:]),ord(w[1][0]),int(w[1][1:])\n",
    "\n",
    "        a=[]\n",
    "        for c in range(c1,c2+1):\n",
    "            for r in range(r1,r2+1):\n",
    "                s=chr(c)+str(r)\n",
    "                a.append(s)\n",
    "        return a\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        cstart,cend = ord(s[0]),ord(s[3])\n",
    "        dstart,dend = ord(s[1]),ord(s[4])\n",
    "        ans = list()\n",
    "        for c in range(cstart,cend+1):\n",
    "            for j in range(dstart,dend+1):\n",
    "                ans.append(chr(c)+chr(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        r1 = ord(s[1]) - ord('0')\n",
    "        r2 = ord(s[4]) - ord('0')\n",
    "        c1 = ord(s[0]) - ord('A')\n",
    "        c2 = ord(s[3]) - ord('A')\n",
    "        ans = []\n",
    "        for c in range(c1, c2 + 1):\n",
    "            for r in range(r1, r2 + 1):\n",
    "                ans.append(chr(c + ord('A')) + str(r))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        a=[chr(i) for i in range(ord(s[0]),ord(s[3])+1)]\n",
    "        b=[i for i in range(int(s[1]),int(s[4])+1)]\n",
    "        return [i+str(j) for i in a for j in b]\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        inp = s.split(':')\n",
    "        c_start,c_end = inp[0][0],inp[1][0]\n",
    "        r_start,r_end = int(inp[0][1]),int(inp[1][1])\n",
    "        cap = string.ascii_uppercase\n",
    "        c_range = cap[cap.find(c_start):cap.find(c_end)+1]\n",
    "        r_range = [i for i in range(r_start,r_end+1)]\n",
    "        r_range = list(map(str,r_range))\n",
    "        res = list(product(c_range,r_range))\n",
    "        ret = [x[0]+x[1] for x in res]\n",
    "\n",
    "        return ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        s1, s3, s4 = s[0], s[3], int(s[4])\n",
    "        while s1 <= s3:\n",
    "            s2 = int(s[1])\n",
    "            while s2 <= s4:\n",
    "                ans.append(s1+str(s2))\n",
    "                s2 += 1\n",
    "            s1 = chr(ord(s1) + 1)\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "      sl=s.split(':')\n",
    "      import re\n",
    "      def dfs(string):\n",
    "          letters = re.findall('[A-Za-z]+', string)\n",
    "          numbers = re.findall('[0-9]+', string)\n",
    "          return letters, numbers\n",
    "      start,end=sl[0],sl[1]\n",
    "      s_letter,s_num=dfs(start)[0][0],int(dfs(start)[1][0])\n",
    "      e_letter,e_num=dfs(end)[0][0],int(dfs(end)[1][0])\n",
    "      ans=[]\n",
    "      for i in range(ord(s_letter),ord(e_letter)+1):\n",
    "          for j in range(s_num,e_num+1):\n",
    "              ans.append((chr(i)+str(j)))\n",
    "\n",
    "      return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        retVal = []\n",
    "\n",
    "        for row in range(ord(s[0]), ord(s[3])+1):\n",
    "            for col in range(ord(s[1]), ord(s[4])+1):\n",
    "                cell = chr(row) + chr(col)\n",
    "                retVal.append(cell)\n",
    "\n",
    "        return retVal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        m = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n",
    "        n = {v: k for k,v in enumerate(list(m))}\n",
    "        nn = {v: k for k,v in n.items()}\n",
    "        start,end = int(s[1]), int(s[-1])\n",
    "        key1,key2 = s[0], s[3]\n",
    "        res = []\n",
    "        for i in range(n[key1], n[key2]+1):\n",
    "            for j in range(start, end+1):\n",
    "                res.append(nn[i] + str(j))\n",
    "        return res\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        letter1 = s[0]\n",
    "        letter2 = s[3]\n",
    "        num1 = int(s[1])\n",
    "        num2 = int(s[4])\n",
    "        for i in range(ord(letter1), ord(letter2)+1):\n",
    "            for j in range(num1, num2+1):\n",
    "                ans.append(chr(i).upper() + str(j))\n",
    "        return ans\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        start_str = s.split(\":\")[0][:1]\n",
    "\n",
    "        end_str = s.split(\":\")[1][:1]\n",
    "\n",
    "        upper_str = string.ascii_uppercase\n",
    "\n",
    "\n",
    "        out_start_num = upper_str.index(start_str)\n",
    "        out_end_num = upper_str.index(end_str)\n",
    "\n",
    "        weight = out_end_num - out_start_num + 1\n",
    "\n",
    "\n",
    " \n",
    "        start_high = int(s.split(\":\")[0][1:])   \n",
    "        end_high = int(s.split(\":\")[1][1:])     \n",
    "        high = end_high - start_high + 1\n",
    "\n",
    "\n",
    "        ret = []\n",
    "        o = 1\n",
    "        while out_start_num <= out_end_num:\n",
    "            n = 1\n",
    "            while start_high <= end_high:\n",
    "                ret.append(upper_str[out_start_num]+str(start_high))\n",
    "                start_high += 1\n",
    "                n+=1\n",
    "            start_high = int(s.split(\":\")[0][1:])\n",
    "            out_start_num += 1\n",
    "            o+=1\n",
    "\n",
    "        return ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        c1=ord(s[0])\n",
    "        r1=int(s[1])\n",
    "        c2=ord(s[3])\n",
    "        r2=int(s[4])\n",
    "\n",
    "        ans=[]\n",
    "\n",
    "        for i in range(c1,c2+1):\n",
    "            for j in range(r1,r2+1):\n",
    "                ans.append(chr(i)+str(j))\n",
    "        \n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for row in range(ord(s[0]),ord(s[3])+1):\n",
    "            for col in range(ord(s[1]),ord(s[4])+1):\n",
    "                res.append(chr(row)+chr(col))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for col in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for row in range(int(s[1]), int(s[4]) + 1):\n",
    "                ans.append(chr(col) + str(row))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        return [chr(c) + chr(r) for c in range(ord(s[0]), ord(s[3]) + 1) for r in range(ord(s[1]), ord(s[4]) + 1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        listStr=[]\n",
    "        for j in range(ord(s[0]),ord(s[3])+1):\n",
    "            for i in range(ord(s[1]),ord(s[4])+1):\n",
    "                tempStr =  chr(j) + chr(i)\n",
    "                listStr.append(tempStr)\n",
    "        return listStr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for col in range(ord(s[0]), ord(s[3])+1):\n",
    "            for row in range(ord(s[1]), ord(s[4])+1):\n",
    "                res.append(chr(col)+chr(row))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for col in range(ord(s[0]), ord(s[3])+1):\n",
    "            for row in range(int(s[1]), int(s[4])+1):\n",
    "                res.append(chr(col)+str(row))\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        s = s.split(':')\n",
    "        col1 = s[0][0]\n",
    "        row1 = s[0][1]\n",
    "        col2 = s[1][0]\n",
    "        row2 = s[1][1]\n",
    "        for col in range(ord(col2)-ord(col1)+1):\n",
    "            for row in range(int(row1),int(row2)+1):\n",
    "                res.append(chr(col+ord(col1))+str(row))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for row in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for col in range(ord(s[1]), ord(s[4]) + 1):\n",
    "                res.append(chr(row) + chr(col))\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        max_index = s[1] + s[-1]\n",
    "        num_l = [str(i) for i in range(int(s[1]),int(s[-1]) + 1)]\n",
    "        num = ord(max([s[0], s[-2]])) - ord(min([s[0], s[-2]]))\n",
    "        char_l = []\n",
    "        char = ord(min([s[0], s[-2]]))\n",
    "        all_l =[]\n",
    "        for i in range(num + 1):\n",
    "            for j in range(len(num_l)):\n",
    "                all_l.append(chr(char) + num_l[j])\n",
    "            char += 1\n",
    "\n",
    "        return all_l"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        a, b = s.split(':')\n",
    "        for ch in ascii_uppercase:\n",
    "            if a[0] <= ch <= b[0]:\n",
    "                for i in range(int(a[1]), int(b[1]) + 1):\n",
    "                    ans.append(ch + str(i))\n",
    "        return sorted(ans)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for i in range(26):\n",
    "            w = chr(ord(\"A\")+i)\n",
    "            if s[0] <= w <= s[3]:\n",
    "                for d in range(1, 10):\n",
    "                    if s[1] <= str(d) <= s[4]:\n",
    "                        ans.append(w+str(d))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        lst = s.split(\":\")\n",
    "        nums = [i[1] for i in lst]\n",
    "        letters = [i[0] for i in lst]\n",
    "        res = []\n",
    "\n",
    "        for i in range(ord(letters[0]),ord(letters[1])+1):\n",
    "            for j in range(int(nums[0]), int(nums[1])+1):\n",
    "                res.append([chr(i), str(j)])\n",
    "        ans = []\n",
    "        for i in res:\n",
    "            ans.append(''.join(i))\n",
    "\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        return [chr(c) + str(r) \n",
    "        for c in range(ord(s[0]), ord(s[3]) + 1) \n",
    "        for r in range(int(s[1]), int(s[4]) + 1)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        start_char = s[0]\n",
    "        start = int(s[1])\n",
    "        end = int(s[-1])\n",
    "        end_char = s[-2]\n",
    "        ans = []\n",
    "        for i in range(ord(start_char), ord(end_char) + 1):\n",
    "            for j in range(start, end + 1):\n",
    "                ans.append(chr(i) + str(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        word = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n",
    "        numbers = \"123456789\"\n",
    "\n",
    "        tmp = s.split(\":\")\n",
    "\n",
    "        index_start = word.index(tmp[0][0])\n",
    "        index_end = word.index(tmp[1][0])\n",
    "\n",
    "        number_start = numbers.index(tmp[0][1])\n",
    "        number_end = numbers.index(tmp[1][1])\n",
    "\n",
    "        loop_word = word[index_start:index_end+1]\n",
    "        loop_number = numbers[number_start:number_end+1]\n",
    "\n",
    "\n",
    "        res = []\n",
    "        for i in loop_word:\n",
    "            for j in loop_number:\n",
    "                res.append(i+j)\n",
    "  \n",
    "        return res\n",
    "\n",
    "\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        for i in range(ord(s[0]), ord(s[3]) + 1):\n",
    "            for j in range(ord(s[1]), ord(s[4]) + 1):\n",
    "                ans.append(chr(i) + chr(j))\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        letter_start = s[0]\n",
    "        letter_end = s[3]\n",
    "        number_start = int(s[1])\n",
    "        number_end = int(s[4])\n",
    "        for word in string.ascii_uppercase:\n",
    "            for i in range(number_start, number_end+1):\n",
    "                if word < letter_start or word > letter_end:\n",
    "                    continue\n",
    "                res.append(word+str(i))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        return [chr(c) + str(r) for c in range(ord(s[0]), ord(s[3]) + 1) for r in range(int(s[1]), int(s[4]) + 1)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        return  [\n",
    "            '{}{}'.format(chr(c),chr(r)) \n",
    "            for c in range(ord(s[0]), ord(s[3]) + 1) \n",
    "            for r in range(ord(s[1]), ord(s[4]) + 1)\n",
    "        ]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        r1 = ord(s[0]) - ord('A')\n",
    "        c1 = int(s[1])\n",
    "        r2 = ord(s[3]) - ord('A')\n",
    "        c2 = int(s[4])\n",
    "        \n",
    "        ans = []\n",
    "        for r in range(r1, r2+1):\n",
    "            for c in range(c1, c2+1):\n",
    "                rr = chr(ord('A')+r)\n",
    "                cc = str(c)\n",
    "                ans.append(rr+cc)\n",
    "        \n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        for x in range(ord(s[3])+1-ord(s[0])):\n",
    "            for i in range(int(s[4])+1-int(s[1])):\n",
    "                res.append(chr(x+ord(s[0]))+str(i+int(s[1])))\n",
    "        return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        container = []\n",
    "        cell_seg = s.split(':')\n",
    "        col_start = list(cell_seg[0])[0]\n",
    "        row_start = int(list(cell_seg[0])[1])\n",
    "        col_end = list(cell_seg[1])[0]\n",
    "        row_end = int(list(cell_seg[1])[1])\n",
    "        for col_ord in range(ord(col_start), ord(col_end)+1):\n",
    "            for row in range(row_start, row_end + 1):\n",
    "                container.append(f'{chr(col_ord).upper()}{row}')\n",
    "        return container"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        l = s.split(':')\n",
    "        num = [int(l[0][-1]), int(l[1][-1])]\n",
    "        alpha = [l[0][0],l[1][0]]\n",
    "        Alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n",
    "        start, end = Alpha.index(alpha[0]), Alpha.index(alpha[1])\n",
    "        result = []\n",
    "        for i in Alpha[start: end+1]:\n",
    "            for j in range(num[0], num[1]+1):\n",
    "                result.append(i+str(j))\n",
    "        return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        c1=ord(s[0])\n",
    "        r1=int(s[1])\n",
    "        c2=ord(s[3])\n",
    "        r2=int(s[4])\n",
    "\n",
    "        ans=[]\n",
    "\n",
    "        for i in range(c1,c2+1):\n",
    "            for j in range(r1,r2+1):\n",
    "                ans.append(chr(i)+str(j))\n",
    "        \n",
    "        return ans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        c_start,c_end = s[0],s[3]\n",
    "        r_start,r_end = s[1],s[4]\n",
    "        lst = []\n",
    "        for i in range(ord(c_start),ord(c_end)+1):\n",
    "            for j in range(int(r_start),int(r_end)+1):\n",
    "                cur = chr(i) + str(j)\n",
    "                lst.append(cur)\n",
    "        return lst"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        res = []\n",
    "        list1 = s.split(\":\")\n",
    "        print(list1)\n",
    "        col1 = list1[0][0]\n",
    "        row1 = list1[0][1]\n",
    "        col2 = list1[1][0]\n",
    "        row2 = list1[1][1]\n",
    "        for c in range(ord(col1),ord(col2)+1):\n",
    "            for r in range(int(row1),int(row2)+1):\n",
    "                res.append(chr(c)+str(r))\n",
    "        return (res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def cellsInRange(self, s: str) -> List[str]:\n",
    "        ans = []\n",
    "        start, end = s.split(\":\")\n",
    "        for c1 in range(ord(start[0]), ord(end[0]) + 1):\n",
    "            for c2 in range(ord(start[1]), ord(end[1]) + 1):\n",
    "                ans.append(f\"{chr(c1)}{chr(c2)}\")\n",
    "        return ans\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
